//
//  QuestionView.m
//  Bespoke
//
//  Created by Cheng on 13/1/17.
//
//

#import "QuestionView.h"
#import "HomePageViewController.h"

@implementation QuestionView
@synthesize WV_Text, SharedCheck;
@synthesize delegate;

- (void)Initialize {
    
    
    //Clean Scroll Shadow.
    for (UIView *subview in [WV_Text.scrollView subviews])
        if ([subview isKindOfClass:[UIImageView class]])
            subview.hidden = YES;
    
    NSString *NS_CSS = @".title{font-weight: bold; font-family: Helvetica; text-decoration: bold; font-size: 16pt; color: #333333;} .subtitle{font-weight: bold; font-family: Helvetica; text-decoration: bold; font-size: 12pt; color: #333333;} .content{font-family: Helvetica-regular; font-size: 12pt; color: #333333; line-height:170%;}";
    
    NSString *NS_Title;
    NSString *NS_Content;
    
    if ([((UIViewController *)self.delegate) isKindOfClass:[HomePageViewController class]]) {
        
        NS_Title = @"Inspiration Stream";
        
        NS_Content = @"<div style=\"margin-left: 30px; \"><span class=\"subtitle\">account settings</span><br>Curation is key! Click this icon at any time to continue to personalize your stream.</br><span class=\"subtitle\">clipping</span><br>Finally found the perfect sofa? Discovered a delicious new dish? Clip postings from your Stream into Inspiration Books using this tool! You can also share a clipping with groups, or via facebook, twitter, & email.</br><span class=\"subtitle\">hotspotting</span><br>Wait-- did you like the lamp or the table?  The hue but not the house ? Use Hotspotting to remind yourself why you saved an image!  Simply twist your thumb and index finger in a circular motion to ‘hotspot’ the image, and leave yourself a note!</br><span class=\"subtitle\">filters</span><br>Too many tweets? Instagram insanity? Use filters to see only chosen media in your Inspiration Stream.  The Bespoke stream is a flow of curated information of things we think are great... try it-- you might discover something new!</br><br><span class=\"subtitle\">Did you know...</span><br>- you can pinch close a clipping when you’re done reading</br>- when viewing a shared clipping you can choose to add it’s feed source to your Inspiration Stream (follow button)<br>- shared clippings & books, along with comments and new group requests will appear in the notification center</br>- you can take a photo or choose from your photo library to add your own photos to Books!<br>- caught in a conundrum? Clicking the ? will help (well, with Bespoke at least!)</br></div>";
        
        
    }
    else if ([((UIViewController *)self.delegate) isKindOfClass:[FeedSetViewController class]]) {
        
        NS_Title = @"Personalize my stream";
        
        NS_Content = @"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Burdened by blogs?  Hounded by #hashtags?</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Welcome to Bespoke Social Media Atelier! Bespoke is a curated, visual environment that brings together all of your social media & blogs you follow, allowing you to save content that is kept private or shared with groups.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Bespoke consists of two main elements-- your Inspiration Stream and your Inspiration Books.  Use this page to start building your stream by adding social media and blogs.  Choose from our recommended feeds or search for those you already love! Pick at least a few to get you started-- you can return to this page at any time to curate additional feeds by clicking the {   } icon.</br>";
    }
    else if ([((UIViewController *)self.delegate) isKindOfClass:[MyBoardUIViewController class]]) {
        
        NS_Title = @"Books";
        if (SharedCheck==FALSE)
            NS_Content = @"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Welcome to your bookshelf!  Here’s where you will create and manage your books-- all books are private until you choose to share them with a group.";
        else if (SharedCheck==TRUE)
            NS_Content = @"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Spread the love! When a book is shared with you, you’ll be able to make comments, and start a conversation.  But only the book’s creator can add or remove clippings from a book-- But can’t all group members contribute clippings to a book you ask?? Well... great	minds think alike-- synced books are coming soon!";
    }
    else if ([((UIViewController *)self.delegate) isKindOfClass:[DetailMyBoardUIViewController class]]) {
        
        NS_Title = @"Books";
        NS_Content = @"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Found some favorites? Trimming some fat?  You can move clippings from one book to 	another, or delete them from a book.  Here’s how:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Click ‘Edit Clippings’</br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Select the clippings you’d like to change<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Click Done</br>";
    }

    NSString *htmlString = [NSString stringWithFormat:@"<html><head><style type=\"text/css\">%@</style></head><body><p><span class=\"title\">%@</span></p><span class=\"content\">%@</span></body></html>", NS_CSS, NS_Title, NS_Content];
    
    [WV_Text loadHTMLString:htmlString baseURL:nil];
    
}

#pragma mark - Touches

- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
    if( point.x > 0 && point.x < self.frame.size.width && point.y > 0 && point.y < self.frame.size.height )
    {
        [delegate uiViewTouched_Question:YES ];
        return YES;
    }
    
    [delegate uiViewTouched_Question:NO ];
    return NO;
}

@end
